package com.java110.mall.market.api;

import com.alibaba.fastjson.JSONObject;
import com.java110.mall.market.bmo.room.IGetRoomsByUserBMO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.xml.ws.Action;

/**
 * 商城查询room信息
 */
@RestController
@RequestMapping(value = "/mallRoom")
public class MallRoomApi {

    @Autowired
    private IGetRoomsByUserBMO getRoomsByUserBMOImpl;

    /**
     * 查询 房屋 信息
     *
     * @param userId 商户ID
     * @return
     * @serviceCode /mallRoom/getRooms
     * @path /app/mallRoom/getRooms
     */
    @RequestMapping(value = "/getRooms", method = RequestMethod.GET)
    public ResponseEntity<String> getRooms(@RequestHeader(value = "user-id") String userId,
                                           @RequestParam(value = "userTel", required = false) String userTel) {
        JSONObject paramIn = new JSONObject();
        paramIn.put("userId", userId);
        paramIn.put("userTel", userTel);
        return getRoomsByUserBMOImpl.getRooms(paramIn);
    }

}
